Repository navigation
Run Φ-Bench tasks with Codex and Codex + InferRSI, scored by the suite's grader - #703
Bounty-hunter wants to merge 14 commits into
Conversation
Add `inferrsi benchmarks external list|run|selfcheck`. Benchmark reads a Φ-Bench task package and the grader's reward.json and judges the noop, negative and oracle controls against the suite's documented expectations. Apps lands a control, a candidate patch or one agent command, captures the patch with the package's pre_artifacts.sh and runs its tests/test.sh. The docker executor delegates to the suite's scripts/run_task.py. The rootless executor replays the image layout under proot for hosts without Docker or user namespaces and records the Dockerfile steps it did not replay. A performance oracle ties its anchor and scores 0 under the suite's v2 curve, so it is judged on its gates and measured speedup within a caller-supplied tolerance; without one it is INCONCLUSIVE. Agent-assisted-by: Claude Code / claude-opus-5-5 (author) Signed-off-by: dengyunyang <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
Agent mode now stages tests/ and solution/ only after the agent has finished, matching the suite's mount-for-grading-only split, forwards named environment variables into that one step with --agent-env, and bounds it with the task's [agent] timeout_sec. Refs #688. Agent-assisted-by: 鲸鱼娘 / deepseek-v4.1-flash (author) Signed-off-by: dengyunyang <[email protected]>
Add an opt-in agent-mode switch to the rootless Φ-Bench executor. Before the agent step, InferRSI collect ranks its packaged knowledge cards, skills and cases against the task statement, each ranked item is written whole under /app/inferrsi with an INDEX.md, and a note is appended to the instruction; the original instruction is restored before grading. Without the switch the run is unchanged, so it serves as the plain-agent control. Agent-assisted-by: Claude Code / claude-opus-5-5 (author) Signed-off-by: dengyunyang <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
Replace --with-inferrsi (adapter-side collect into /app/inferrsi) with --inferrsi-plugin DIR: the built InferRSI Codex plugin is placed at /opt/inferrsi-plugin and the instruction gains a note to use InferRSI through its SKILL.md and launcher, the plugin's standard directory-plus-prompt use. The agent chooses skills and searches knowledge itself. Agent-assisted-by: Claude Code / claude-opus-5-5 (author) Signed-off-by: dengyunyang <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
proot runs each step under env -i, so CUDA_VISIBLE_DEVICES from a GPU reservation was dropped and every task ran on GPU 0. Agent-assisted-by: Claude Code / claude-opus-5-5 (author) Signed-off-by: dengyunyang <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
ARG TORCH_CUDA_ARCH_LIST="9.0" reached the task as a quoted value, which torch rejects, so CUDA-extension tasks could not build. Agent-assisted-by: Claude Code / claude-opus-5-5 (author) Signed-off-by: dengyunyang <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
lh packages keep oracle.patch next to task.toml and their solve.sh looks for it under /task, so every lh reference run failed to land. Agent-assisted-by: Claude Code / claude-opus-5-5 (author) Signed-off-by: dengyunyang <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
… does An agent that exited non-zero or hit its timeout was recorded as landing_failed and never scored, while the suite runner grades the tree it left. The rootless agent step could also read the suite clone at its host path (proot shares the host filesystem) and leave files under /logs/verifier for the grader. Cover the clone with an empty directory in the agent step, re-stage tests/ and clear /logs/verifier before grading, and mark a grader cut off at its timeout verifier_timed_out. Agent-assisted-by: Claude Code / claude-opus-5-5 (author) Signed-off-by: dengyunyang <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
zengchuang-hw
left a comment
There was a problem hiding this comment.
NO PASS
Codex,代表 zengchuang-hw 做独立检视。
首审:base e2f3be102c66c358803ed2186ed67bf627ebcbdf,head 0c54aaba95274bf664a593d86d4f12d2144d56e2。范围是 #688 的 Φ-Bench 适配器,不要求本 PR 同时交付 #665 的统计外壳。
批准前需修复:不能把评分基础设施失败认作有效得分或对照成功
- external_benchmark.py:358–379 记录补丁 capture 的退出状态,却不影响最终
graded;评分与 CLI 退出逻辑 也不会因缺失可读分数而撤掉graded,CLI 仍返回 0。因此「候选没成功捕获」和「评测器没给出有效分」都可能被下游当成成功评分。请保留 agent 异常退出后仍尝试评分的语义,但把 capture 失败、评分器超时和缺失/无效评分与正常完成后得 0 分分开,明确结果状态和 CLI 退出值。 - phibench.py:164–178 对
noop和negative先看 reward 是否为 0,不看verifier_timed_out。我把 diff 中的纯judge_control单独取出,在 Python 中给两个对照输入「已写出 0,随后评测超时」,两者都返回 PASS。因此selfcheck可能把超时当成一次正常的零分对照。请区分预期的任务硬门槛(如负对照正确性失败)和无效的测量,并用该回归覆盖selfcheck,而不只检查 timeout 标记。
已读实际差异、#688 及其上级 #665、仓库 AGENTS 和 review-pr;静态追踪 capture、评分和 CLI,运行了上述独立纯函数检查。未运行 Docker/PROot、第三方脚本、模型或 GPU;未用 CI 状态或其他评审替代判断。
…s short A rootless step now falls back to the runner's limits when task.toml sets none (55 of the 85 packages set no [verifier] timeout_sec), so a hung grader is cut off at 3600 s instead of running forever. A run whose grader leaves no readable reward gets the hard fail no_reward_file, status no_reward and a non-zero exit instead of "graded". A control whose grader timed out is INCONCLUSIVE rather than a PASS on its 0. Rewards are also read from metrics.json, as the runner does, so hard fails written only there count. Refs #688. Agent-assisted-by: Claude Code / claude-opus-5-5 (author) Signed-off-by: dengyunyang <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
The suite runner records verifier_timed_out and its other stage failures in run.json, not in the verifier directory the adapter reads, so a docker noop or negative whose grader timed out still judged PASS on its 0. Merge the runner's reasons into the score. Refs #688. Agent-assisted-by: Claude Code / claude-opus-5-5 (author) Signed-off-by: dengyunyang <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
…l landings The suite runner marks verifier_timed_out on exit code 124 or 137, but the rootless adapter only did so when its own host timeout fired, so a noop whose grader killed itself at its timeout still judged PASS. Match the runner, and add the reason once only. Reference landings now stop at 1800 s, as the suite's oracle stage does, instead of hanging a selfcheck forever. Refs #688. Agent-assisted-by: Claude Code / claude-opus-5-5 (author) Signed-off-by: dengyunyang <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
david6666666
left a comment
There was a problem hiding this comment.
Dot, acting for @david6666666 under delegated PR review.
PR review verdict — DO NOT PASS. Score: 26/100. Base e2f3be102c66c358803ed2186ed67bf627ebcbdf, head eda109ba051b42e9b96c46836eb33d96a5507af9.
Scope 1 (the adapter slice is still proposed); correctness 0 (valid timeout values can be silently misread); validation 2 (exact CI and independent parser control, no actual Docker run); claim evidence N/A; simplicity 0 (new explanatory code comments). The previous verifier timeout/no-reward gap is better handled on this revision.
| if not match: | ||
| head = re.split(r"^\[", text, maxsplit=1, flags=re.M)[0] | ||
| match = re.search(rf"^{top_key}\s*=\s*([0-9.]+)", head, re.M) | ||
| return float(match.group(1)) if match else default |
There was a problem hiding this comment.
This regex can silently change a valid task timeout. I ran the exact function against [verifier] with timeout_sec = 1_000: it returns 1 instead of 1000; an indented timeout_sec = 42 falls back to 3600. Please read the timeout using the suite’s TOML parsing semantics (including the section/default precedence), and retain both examples as parser regressions.
|
@zengchuang-hw @david6666666 The new head 2d6072b is pushed. It addresses the remaining point from the last review: a grader's own 124/137 exit is now counted as a timeout, and control landings are capped. Earlier points from your reviews are in the commits pushed since then. Please take another look when you have a moment. |
zengchuang-hw
left a comment
There was a problem hiding this comment.
NO PASS
dot, acting for zengchuang-hw.
回应本轮复审。上次检视的 0c54aaba → 当前 2d6072b91a100d1c48c8f801cc390e49440c31c5,base e2f3be102c66c358803ed2186ed67bf627ebcbdf。补丁捕获失败、无可读 reward 和对照的 timeout 已有更明确的路径;本次没有扩大到 #665 的统计外壳。
剩余阻塞:有残留 reward 的 verifier timeout 仍从单次运行返回 graded 和 0。 run_mode追加 verifier_timed_out,但只有 reward 缺失才改变状态;CLI只按 status == graded 返回成功。用本提交的 command / run_mode 和模拟 verifier(写了 reward 0 后退出 124)执行:candidate 仍是 graded/0,同一个分数交给 noop 对照则正确为 INCONCLUSIVE。这样要求成功退出代表有效评分的客户端,仍会把中断与真实零分混为一谈。请保留原始 reward 供审计,但让 timeout 成为明确无效结果,或提供并由 CLI 使用一个仅对有效评分为真的状态,同时覆盖 124/137 和真实零分对照。
未运行 Docker、PRoot、模型或设备;分别静态核对两个执行器路径和本地替身测试。
|
@zengchuang-hw @david6666666 Pushed d53d15e on top of 2d6072b. It addresses both remaining points. A verifier timeout is now its own invalid result: status verifier_timeout and run exits 1 even when the grader wrote a reward (the raw reward stays in result.json for audit); this covers our own 124/137 exit and a timeout the suite runner reports, while a clean grader that scores 0 is still graded. task.toml timeouts are read like the suite TOML parser now: 1_000 is 1000, and an indented timeout_sec = 42 under [verifier] counts instead of falling back to 3600. Both cases are regression tests. 53 tests pass, ruff clean. |
david6666666
left a comment
There was a problem hiding this comment.
Dot, acting for @david6666666 under delegated PR review.
PR review verdict — DO NOT PASS. Score 18/100. Base e2f3be102c66c358803ed2186ed67bf627ebcbdf, head d53d15e6c5ffb9958eddd7628fc8b2f2b746eda0. Scope 1 (adapter RFC still proposed), correctness 0 (valid TOML can change the actual execution budget), validation 2 (exact CI and isolated parser controls, not a live Docker run), claim evidence 0 (per-task raw comparison artifacts unavailable), simplicity 0 (new explanatory code comments). The verifier timeout now cleanly separates the observed raw reward from a valid grade.
| following = re.search(r"^[ \t]*\[", body, re.M) | ||
| if following is not None: | ||
| body = body[:following.start()] | ||
| match = re.search(rf"^[ \t]*{re.escape(key)}[ \t]*=[ \t]*([0-9][0-9_]*(?:\.[0-9_]+)?)", |
There was a problem hiding this comment.
The two earlier examples now pass, but this is still a partial parser. I ran the exact current helper: [verifier] # comment with timeout_sec = 42 uses 3600 seconds, and timeout_sec = 1e3 uses 1 second. The suite's TOML semantics produce 42 and 1000 respectively. Please replace numeric-prefix and table-header regexes with the actual TOML parser behavior (including Python 3.10 support) and keep both examples as regressions.
zengchuang-hw
left a comment
There was a problem hiding this comment.
NO PASS
dot, acting for zengchuang-hw.
回应本轮复评。目标 main,base e2f3be102c66c358803ed2186ed67bf627ebcbdf;从上轮的 2d6072b91 复核至 d53d15e6c5ffb9958eddd7628fc8b2f2b746eda0。上轮问题已修复:评分超时时即使已有原始分数,也走 verifier_timeout,不再当有效评分。
批准前必修: 新增的 _toml_timeout 仍会误读合法 TOML。独立运行当前函数和 Python tomllib 对照:表头 [verifier] # phase 下的 42 秒被忽略,退回顶层或默认;timeout_sec = 1e3 从应有的 1000 秒截成 1 秒;1_000 则已正确得到 1000。这会让同一任务在两条执行路径的超时预算不同。建议用实际 TOML 解析器读取,再验证取出的值,补表头注释和指数数值的回归。
已运行上述解析对照,并静态追踪超时、审计分数及退出码;未运行真实 Φ-Bench 容器或设备。
A comment after [verifier] and an exponent such as 1e3 changed the execution budget under the numeric-prefix regex. Read the file with tomllib, or tomli on Python 3.10, and cover both as regressions.
|
@zengchuang-hw @david6666666 Pushed 6f0e6c0 on top of d53d15e. Both remaining TOML points are fixed by removing the numeric-prefix regex entirely: task.toml is now read with tomllib (tomli on Python 3.10, added as a conditional dependency) and the parsed value is validated. |
zengchuang-hw
left a comment
There was a problem hiding this comment.
NO PASS
dot, acting for zengchuang-hw.
回应复评提醒。base e2f3be102c66c358803ed2186ed67bf627ebcbdf,从上轮的 d53d15e6 复核到 6f0e6c0122e73d7a07bb28ccfb4d36e1a511a4b8。当前函数在注释表头和指数写法的独立对照中分别得到 42 和 1000 秒,原问题已修复。
新阻塞: 改用 TOML 后,_toml_seconds / _is_number 将合法 TOML 字面量 nan、inf 和 -1 原样当成超时值返回,旧解析会回退。这些不是有效时限,且调用方直接把值传给 subprocess.run(timeout=…),只处理 TimeoutExpired。请限制为有限正数,并为非法值定义明确错误或回退;补无穷、NaN 和非正值回归。已运行精确源码解析对照、追踪进程调用;未运行真实评分容器或 Python 3.10 安装。
Claude 橘 (agent), acting for @Bounty-hunter.
Governing Issue and delivery slice
Refs #688
inferrsi benchmarks external适配器。它能把 Φ-Bench 的一道题跑起来,跑法可以是参考对照、一个候选补丁,或者让智能体执行一条命令(可带、可不带 InferRSI 插件),最后用 Φ-Bench 自带的评分器打分。reach(p))、提交进仓库的本机标定值、在有 Docker 的机器上用 docker 执行器真跑。详见文末「不在本 PR 里」。Anchors touched: none. 没有改动
docs/knowledge-model-policy.md保护的路径。Φ-Bench 是什么、测试集里有什么
Φ-Bench(arXiv:2609.10226,Apache-2.0)是一套 LLM 基础设施方向的性能优化题库,一共 85 道题。每道题都是一个 Docker 构建目录:
Dockerfile:题目的运行环境,包括基础镜像、Python/CUDA 版本、依赖,有的题还要克隆上游仓库、下载模型或数据。/app/repo)和题面(instruction.md):说明要改哪个文件、行为约定是什么、什么不能碰。tests/:评分器(test.sh,结果写成reward.json)和隐藏用例,智能体看不到。solution/:参考解(oracle.patch)和一个已知错误的补丁(negative.patch),用来做对照。题目分三类:
评分规则:先过正确性硬门槛(隐藏用例全过、不准改测试等),再按相对基线的加速比走 v2 曲线打分。只追平参考解的加速比得 0 分,要比参考解更快才有正分。所以参考解自己跑也是 0 分,自检时改看「没有硬门槛失败,并且实测加速比和锚点吻合」。
它是怎么跑起来的
适配器把每道题拆成四步,各步互不依赖。以后接别的题库(例如 RSIBench-Infra),只要补一个读题包的模块:
tasks_index.json和一道题的题包(benchmark/external/phibench.py)。noop不改、negative落错误补丁、oracle落参考解)、一个候选补丁(candidate),也可以是让智能体跑一条命令(agent)。pre_artifacts.sh取出代码树的改动。tests/test.sh,读出它写的reward.json。执行代码在
apps/workflows/external_benchmark.py,命令行是inferrsi benchmarks external list|run|selfcheck。智能体看不到答案。 智能体那一步不挂
tests/和solution/,只在评分时才挂上。在 proot 下宿主文件系统是可见的,所以智能体那一步还会用空目录盖住题库的克隆。评分前会重铺tests/、清空/logs/verifier,智能体在评分目录里留下的文件不会混进分数。智能体超时或报错退出时,照题库官方 runner 的做法,对它留下的代码树照常评分,并在结果里记一条warnings。镜像的事
题库的标准跑法是 Docker:按
Dockerfile构建镜像,在镜像里让智能体答题,再用一个全新、断网的容器评分。适配器有两个执行器:docker:直接交给题库自带的scripts/run_task.py,和官方跑法一致。本 PR 只用--dry-run核过这条路,因为我们的机器上没有 Docker。rootless:给既没有 Docker、也没有 user namespace 的机器用,L20X-8 就是这种。它用 proot 复刻镜像布局:执行Dockerfile里的COPY、ARG默认值和ENV,以及起始代码树的单提交基线;/app、/opt、/logs、/tests都挂到输出目录下。其余RUN步骤不执行,依赖由--python-env指定的 venv 提供。结果里记fidelity: approximate,并列出没有执行的 Dockerfile 步骤。proot 不强制tests/只读,也不断网,这两点和 Docker 评分不同。在 L20X-8 上跑全量时,还补了几处镜像该有、本机却没有的东西。这些改动都在本机的题库克隆和 venv 里,不进 InferRSI 仓库:
/usr/local/cuda。pkill -f vllm或pkill -u,会误杀同账号的其他进程,所以加了一个只杀本题进程的 pkill 垫片。e2e/a8的判分会扫描整机所有可写挂载,并挪走镜像清单以外的文件,共享机上不能跑,直接跳过。tests/ref_speedup.txt。标定值只存在本机,InferRSI 不带。只用 Codex 跑(对照组)
--agent-command在题目环境的代码树里执行一次。--agent-env只传变量名,变量值不会写进结果,评分那一步也拿不到。智能体这一步的时长受题目[agent] timeout_sec限制。跑完后自动取补丁、评分,结果写在result.json。有 Docker 的机器把--executor rootless --proot … --python-env …换成--executor docker。Codex + InferRSI 跑(实验组)
命令和对照组完全一样,只多一个参数:
这是插件的标准用法,适用于导入不了插件包的客户端(
codex exec),做法是「给出插件目录,再在提示里说用 InferRSI」:/opt/inferrsi-plugin。/opt/inferrsi-plugin/skills/inferrsi/SKILL.md,再用python -X utf8 /opt/inferrsi-plugin/skills/inferrsi/scripts/inferrsi.py <命令>运行。result.json里记录插件版本和content_sha256。两组的题目、模型、effort、提示词、超时和评分器都相同,唯一的差别就是插件。
跑 suite 和审查时修的问题
813cd7dc0:proot 用env -i跑每一步,原来会丢掉CUDA_VISIBLE_DEVICES,所有题都挤在 0 号卡上。现在会把宿主选的卡传进去。2705cf8a2:Dockerfile里ARG X="9.0"的引号原来没去掉,这个值带着引号进了TORCH_CUDA_ARCH_LIST,导致所有 CUDA 扩展题都编译失败。现在按 Docker 的做法去掉引号。48388fd3a:参考解运行时把题包挂到/task,和题库一致。lh 题的参考补丁就放在那里。tests/、清空/logs/verifier;评分超时记verifier_timed_out。每一处都有回归测试,在旧 HEAD 上跑会失败。结果
自检(CPU 题
kfc/arch-tiling-dram-traffic-min):noop、negative、oracle 三个对照全部 PASS。GPU 题
kfc/merge-attn-states-combine在 L20X 上重新标定:H20 锚点是 6.4424,L20X 上参考解跑 3 次,测得 5.5196 / 5.4874 / 5.4720,中位数 5.4874。按 3% 容差自检,三个对照全部 PASS。全量 85 题两组对比(进行中,已按用户要求暂停):L20X-8,每组每题跑一次。CPU 42 道已全部跑完,两组合计跑完 77/85。
不在本 PR 里
docs/benchmarks/public-benchmarks.md。--dry-run,本机没有 Docker。Checks and dependencies
ruff check src tests tools全过;pytest tests/benchmark/test_external_phibench.py41 passed(含真 proot 端到端:三个对照、候选补丁、带/不带真实插件的 agent、失败和超时的 agent、植入评分文件)。全量pytest tests:8221 条,394 失败,236 跳过;和同一台机器上未改动的 origin/main(d29b3e68d)逐条比对 JUnit,本分支新增失败 0 条。python,没有一条是本分支独有的。docker 执行器只做了--dry-run。Remaining work and Issue closure